import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
#from matplotlib_inline import backend_inline
import torch
import torch.nn as nn
import torch.optim as optim
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.preprocessing import MinMaxScaler
from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score
from torch.optim.lr_scheduler import ReduceLROnPlateau
backend_inline.set_matplotlib_formats('svg')


# --------------------- 数据读取和预处理 ---------------------
data = pd.read_csv("E:/GraduateDesign/LinearUse_processed.csv")
#matplot字体选择
plt.rcParams['font.sans-serif'] = ['SimHei']  # 指定默认字体
plt.rcParams['axes.unicode_minus'] = False    # 解决负号显示问题

# # 数据分析
# # print("\n===== 目标变量(rrr)分布分析 =====")
# # print(data['rrr'].describe())
# plt.figure(figsize=(10,4))
# plt.subplot(1,2,1)
# plt.hist(data['rrr'], bins=50)
# plt.title("原始数据分布")
# plt.subplot(1,2,2)
# plt.boxplot(data['rrr'], vert=False)
# plt.title("箱线图")
# plt.show()





#______________学习_______________________________
x=data['timestamp']
y=data['rrr']


fig1 = plt.figure()
plt.axis('equal')
plt.xlim(0,60)
plt.ylim(0,20000)
plt.hist(y,histtype='stepfilled', color='red')
plt.legend(['<a>', '<b>'])
plt.show()


